package test;

public class CountItemPrice {

    public static void main(String[] args) {
        double num = 10;
        String type = "苹果";
        double result = getItemPrice(num, type);
        System.out.println("商品的价格为："+result);
    }

    private static double getItemPrice(double num, String type) {
        switch (type){
            case "苹果":
                return num * 3.5;
            case "橘子":
                return num * 5;
        }
        return 0;
    }

}
